<template>
	<view class="content">
		<!-- 积分数以及积分提现 -->
		<view class="f1">
			<text>
				<text style="font-size: 60rpx; margin-left: 20rpx;  border-radius: 40%;">积分：</text>
			{{user.integral
}}
			</text>
			<!-- <view class="tixian" @click="goto('/pages/rewards/rewards')">
				申请提现
			</view> -->
		</view>
		
		<!-- 分段器 积分明细 积分收入 积分支出 -->
		<view class="f2">
			<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text" activeColor="#4cd964"></uni-segmented-control>
			        <view class="content">
			            <view v-show="current === 0"  >
			                <!-- 显示积分明细 -->
			                <view v-for="detail in pointDetails" :key="detail.id">
			                <!-- 在这里显示积分明细的内容，根据具体数据结构进行展示 -->
			             
			                </view> 
			            </view>
			        
			        </view>
		</view>
	</view>
</template>

<script>
	import {} from '../../common/api/integral.js';
	export default {
		data() {
			return {
				title:'我的积分',
			
				current: 0,
				pointDetails: [], // 存储积分明细数据
				pointIncome: [], // 存储积分收入数据
				pointExpense: [], // 存储积分支出数据
				user:{},
			}
		},
		mounted(){
			this.user = uni.getStorageSync('user');
		},
		methods: {
			onClickItem(e) {
			    if (this.current != e.currentIndex) {
					this.current = e.currentIndex;
					if(this.current==0){
					uni.navigateTo({
					url: '../rewards/rewards'
					})
					}
					this.current = e.currentIndex;
					if(this.current==1){
					uni.navigateTo({
					url: '../rewards2/rewards2'
					})
					}
			    }
			},
			goto(url) {
				if (!this.user) {
					uni.navigateTo({
						url: '../login/login'
					})
				} else {
					uni.navigateTo({
						url: url
					})
				}
			
			},
		}
	}
</script>

<style lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.f1{
		width: 100%;
		height: 400rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		font-size: 70rpx;
		color: #f8f8f8;
		background-color: #6FCF97;
		
		.tixian{
			width: 145rpx;
			margin-top: 20rpx;
			font-size: $uni-font-size-base;
			color: #f8f8f8;
			border-radius: 40rpx;
			border: 1px solid #f8f8f8;
			padding: 10rpx;
		}
	}
	.f2{
		width: 100%;
	}
</style>
